const db = wx.cloud.database()
Page({
  data: {
    detail:[],
    items:[],
    display:"none"
  },
  onLoad: function (e) {
    var that = this ;
    wx.showLoading({
      title: '加载中...',
    })
    db.collection('work').where({
      _id: e.id
    }).get({
      success: function (res) {
        if(res.data[0].src!=null){
          that.setData({
            display:""
          })
        }
        that.setData({
          detail:res.data[0],
          items:res.data[0].fileList
        })
        wx.hideLoading({
          success: (res) => {},
        })
      }
    })
  },
  ImagePreview(e) {
    console.log(e)
    var that = this;
    var src = e.target.dataset.url; //获取data-src
    var imgList = that.data.detail.fileList; //获取data-list
    //图片预览
    wx.previewImage({
      current: src, // 当前显示图片的http链接
      urls: imgList // 需要预览的图片http链接列表
    })
  }
})